// 题目链接：https://www.luogu.com.cn/problem/P1157

#include <iostream>

using namespace std;

const int N = 30;

int n, r;
int q[N];

void DFS(int pos, int start)
{
    // 剪枝
    if (n - start + 1 < r - pos + 1)
    {
        return;
    }

    if (pos > r)
    {
        for (int i = 1; i <= r; ++i)
        {
            printf("%3d", q[i]);
        }
        printf("\n");

        return;
    }

    for (int i = start; i <= n; ++i)
    {
        q[pos] = i;
        DFS(pos + 1, i + 1);

        // 恢复环境
        q[pos] = 0;
    }
}

int main()
{
    scanf("%d %d", &n, &r);
    DFS(1, 1);

    return 0;
}